import {get, lsGetStr, post} from "../../utils/request.js";
import { getType} from "../../utils/data_type.js";

Component({
    properties: {
      
    },
    data: {
      remark: '',
      banners:[],
      categorys:[]
    },
    lifetimes: {
        attached: function () {
        },
        moved: function () {
        },
        detached: function () {
        },
    },
    attached() {
    }, // 此处attached的声明会被lifetimes字段中的声明覆盖
    ready: function () {
    },
    methods: {
      login: function () {
        let that = this;
        for (var item of that.data.banners) { //
          that.setData({
            // remark: item.remark
            remark: 'http://www.baidu.com'
          })
        }
        wx.navigateTo({
          url: '../login/index?src=' + that.data.remark,
        })
      },
    },
    
    pageLifetimes: {
        // 组件所在页面的生命周期函数
        show: function () {
            let that = this;
            get({
              path: '/category1/list?type1=' + getType.carousel+'&isShow=1&sortField=order_num&sortOrder=ASC'
            })
                .then(function (res) {
                    that.setData({
                        banners:res
                    })
                })
        },
    },
})
